REAL INJURIES FOR ALL (CPU included)  -  v1.1
For FOOTBALL LIFE 2026 (FL26) - Master League
by Michele, written together with Claude (Anthropic AI) - October 2026
=====================================================================

WHAT IS NEW IN v1.1 (29/10/2026)
- Fixed: the game could crash when you START A NEW Master League.
  While a new career is being created, the game builds temporary copies of all the players and
  frees memory all the time. v1.0 could (a) read a piece of memory just freed by the game, or
  (b) take a temporary copy for the real player table and write injuries into it.
  v1.1 reads and writes memory in a safe way (if the game has freed it, the module just skips it,
  the game does not crash) and uses the player table only after finding it twice in the same
  place, 30 seconds apart. In sider.log you first see "player table seen", then "player table found".
- Nothing else changes: same injury lengths, same rules for your club and the CPU.
- Update: replace injuries_for_all.lua with the new one. Your sider.ini line stays the same.

WHAT IT DOES
In Master League the game gives CPU players (and often yours too) injuries of only
1-5 days: by the next match they are always fit, so CPU teams never really lose a player.
This Sider module makes injuries real, with the same rules for everybody, your club and
the CPU:

1) REALISTIC LENGTHS. When the game creates one of those 1-5 day injuries, the module draws
   a real length from this table (out of 100 injuries):
      42  stay short (1-5 days)
      33  1-3 weeks
      16  3 weeks - 2 months
       6  2-4 months
       2  4-6 months
       1  6-8 months  (248 days max: the game cannot store more than 255)
   Injuries the game already made longer than 5 days are left alone.

2) NEW INJURIES EVERY DAY. For every calendar day that passes, 0.25% of the healthy players
   in the whole world get injured, with the same lengths. It works with PLAYED and with
   SIMULATED matches. In our test the world settled at about 6% of players injured
   (1977 of 32552), which is what you see in real leagues.

3) THE CPU MUST REACT. A CPU team with its striker out for 4 months has to use the bench or
   go to the transfer market. The game itself counts the days down and the CPU leaves
   injured players out of its line-ups.

SAFETY
New injuries are created only in the calendar, never when the line-ups of the next match are
already decided (otherwise the CPU could field an injured player, play with 10 men and crash
the game at the end of the match). If days pass at that moment, the injuries are created at
the next check.

REQUIREMENTS
- Football Life 2026 with Sider (tested with Sider 7.4.3)
- In sider.ini:  luajit.ext.enabled = 1
- Master League only (it does nothing in cups, exhibition matches, etc.)
- It does NOT patch the exe and does NOT replace any file: it only works in memory.
- Tested on FL26 with a 32,600-player database: played and simulated matches, several weeks
  of Master League calendar, buying an injured player.

INSTALL
1. Copy  SiderAddons\modules\injuries_for_all.lua  into your  SiderAddons\modules  folder.
2. Open sider.ini and add this line in the lua.module list (on its own line, no comment
   on the same line):
       lua.module = "injuries_for_all.lua"
3. Check that sider.ini has:  luajit.ext.enabled = 1
4. Start Sider, then the game, and load your Master League.
5. Look in sider.log for lines starting with "INJURIES FOR ALL":
     "player table found (NNNNN players)"         -> the module found the data
     "Name (id ...): 3 -> 41 days"               -> a short injury became realistic
     "22 days passed: ... new injuries"           -> new injuries for the days that passed
     "injured players in the world now: ..."      -> how many injured players in the world

GOOD TO KNOW
- The player table is found when at least one player in the world is injured. In a brand
  new career it starts working after the first injury (usually within the first days).
- The first search of the table takes a moment; it is done in the menus, not during matches.
- You can buy an injured player: the transfer screens may not show the injury, so you can
  discover it only after the deal, like a failed medical in real life. We kept it that way.
- The module writes  injuries_for_all.txt  in the SiderAddons folder: it remembers which
  injuries were already decided, so a restart does not draw them again.
- It does not change injuries during the match (that is the constant_match "injury" values
  of the gameplay): it works on the days out.

SETTINGS (top of injuries_for_all.lua, open it with Notepad)
  PROB_GIORNO = 0.0025   share of healthy players injured per day
                          0.0025 = about 6% injured in the world
                          0.0015 = about 3.5%    0.0035 = about 8%
  FASCE                   the length table: { min days, max days, weight }
  SOGLIA_BREVE = 5        game injuries up to this many days get a new length

UNINSTALL
Remove the lua.module line from sider.ini (and delete injuries_for_all.txt in SiderAddons).
Injuries already given stay until they heal.

Feel free to use it in your own packs: just credit the author.
